#!/bin/bash
# 防止进程被杀死,采用maven工程进行构建，修改BUILD_ID无效，后台进程随着jenkins构建完成后仍被杀死
#export BUILD_ID=dontKillMe

num=`docker container ls -a | grep summer_boss_backend.jar:stable | grep -v grep | wc -l`

if [[ $num -gt 0 ]]; then
  echo "stopping the old boss_backend service"
  docker rm -f boss_backend
  echo "old boss_backend service service stoped"
fi
echo "boss_backend service starting"
docker run -d -p 8083:8082 -e "SPRING_PROFILES_ACTIVE=prd" -v /app/logs/:/app/logs \
  --name boss_backend 172.17.0.9:9001/service/summer_boss_backend.jar:stable
#sleep 10
echo "boss_backend service started"